using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace WpfBill.Data
{
    /// <summary>表字段值</summary>
    [Serializable]
    [DataObject]
    [Description("表字段值")]
    [BindTable("tb_datafieldvalue", Description = "表字段值", ConnName = "MyConn", DbType = DatabaseType.None)]
    public partial class DataFieldValue : IDataFieldValue
    {
        #region 属性
        private Int32 _ID;
        /// <summary></summary>
        [DisplayName("ID")]
        [DataObjectField(true, true, false, 0)]
        [BindColumn("ID", "", "int(11)")]
        public Int32 ID { get => _ID; set { if (OnPropertyChanging("ID", value)) { _ID = value; OnPropertyChanged("ID"); } } }

        private Int32 _RowID;
        /// <summary>记录ID</summary>
        [DisplayName("记录ID")]
        [Description("记录ID")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("RowID", "记录ID", "")]
        public Int32 RowID { get => _RowID; set { if (OnPropertyChanging("RowID", value)) { _RowID = value; OnPropertyChanged("RowID"); } } }

        private Int32 _TableID;
        /// <summary>表ID</summary>
        [DisplayName("表ID")]
        [Description("表ID")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("TableID", "表ID", "")]
        public Int32 TableID { get => _TableID; set { if (OnPropertyChanging("TableID", value)) { _TableID = value; OnPropertyChanged("TableID"); } } }

        private Int32 _FieldID;
        /// <summary>表字段ID</summary>
        [DisplayName("表字段ID")]
        [Description("表字段ID")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("FieldID", "表字段ID", "")]
        public Int32 FieldID { get => _FieldID; set { if (OnPropertyChanging("FieldID", value)) { _FieldID = value; OnPropertyChanged("FieldID"); } } }

        private Int32 _IntValue;
        /// <summary>Int值</summary>
        [DisplayName("Int值")]
        [Description("Int值")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("IntValue", "Int值", "")]
        public Int32 IntValue { get => _IntValue; set { if (OnPropertyChanging("IntValue", value)) { _IntValue = value; OnPropertyChanged("IntValue"); } } }

        private String _StrValue;
        /// <summary>string 值</summary>
        [DisplayName("string值")]
        [Description("string 值")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("StrValue", "string 值", "varchar(100)")]
        public String StrValue { get => _StrValue; set { if (OnPropertyChanging("StrValue", value)) { _StrValue = value; OnPropertyChanged("StrValue"); } } }

        private DateTime _DateValue;
        /// <summary>日期值</summary>
        [DisplayName("日期值")]
        [Description("日期值")]
        [DataObjectField(false, false, true, 0)]
        [BindColumn("DateValue", "日期值", "")]
        public DateTime DateValue { get => _DateValue; set { if (OnPropertyChanging("DateValue", value)) { _DateValue = value; OnPropertyChanged("DateValue"); } } }

        private Double _DoubleValue;
        /// <summary>Double值</summary>
        [DisplayName("Double值")]
        [Description("Double值")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("DoubleValue", "Double值", "")]
        public Double DoubleValue { get => _DoubleValue; set { if (OnPropertyChanging("DoubleValue", value)) { _DoubleValue = value; OnPropertyChanged("DoubleValue"); } } }

        private String _CreateUser;
        /// <summary>创建者</summary>
        [DisplayName("创建者")]
        [Description("创建者")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("CREATE_USER", "创建者", "")]
        public String CreateUser { get => _CreateUser; set { if (OnPropertyChanging("CreateUser", value)) { _CreateUser = value; OnPropertyChanged("CreateUser"); } } }

        private Int32 _CreateUserID;
        /// <summary>创建用户</summary>
        [DisplayName("创建用户")]
        [Description("创建用户")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("CREATE_USERID", "创建用户", "")]
        public Int32 CreateUserID { get => _CreateUserID; set { if (OnPropertyChanging("CreateUserID", value)) { _CreateUserID = value; OnPropertyChanged("CreateUserID"); } } }

        private DateTime _CreateTime;
        /// <summary>创建时间</summary>
        [DisplayName("创建时间")]
        [Description("创建时间")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("CREATE_TIME", "创建时间", "")]
        public DateTime CreateTime { get => _CreateTime; set { if (OnPropertyChanging("CreateTime", value)) { _CreateTime = value; OnPropertyChanged("CreateTime"); } } }

        private String _UpdateUser;
        /// <summary>更新者</summary>
        [DisplayName("更新者")]
        [Description("更新者")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("UPDATE_USER", "更新者", "")]
        public String UpdateUser { get => _UpdateUser; set { if (OnPropertyChanging("UpdateUser", value)) { _UpdateUser = value; OnPropertyChanged("UpdateUser"); } } }

        private Int32 _UpdateUserID;
        /// <summary>更新用户</summary>
        [DisplayName("更新用户")]
        [Description("更新用户")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("UPDATE_USERID", "更新用户", "")]
        public Int32 UpdateUserID { get => _UpdateUserID; set { if (OnPropertyChanging("UpdateUserID", value)) { _UpdateUserID = value; OnPropertyChanged("UpdateUserID"); } } }

        private DateTime _UpdateTime;
        /// <summary>更新时间</summary>
        [DisplayName("更新时间")]
        [Description("更新时间")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn("UPDATE_TIME", "更新时间", "")]
        public DateTime UpdateTime { get => _UpdateTime; set { if (OnPropertyChanging("UpdateTime", value)) { _UpdateTime = value; OnPropertyChanged("UpdateTime"); } } }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ID": return _ID;
                    case "RowID": return _RowID;
                    case "TableID": return _TableID;
                    case "FieldID": return _FieldID;
                    case "IntValue": return _IntValue;
                    case "StrValue": return _StrValue;
                    case "DateValue": return _DateValue;
                    case "DoubleValue": return _DoubleValue;
                    case "CreateUser": return _CreateUser;
                    case "CreateUserID": return _CreateUserID;
                    case "CreateTime": return _CreateTime;
                    case "UpdateUser": return _UpdateUser;
                    case "UpdateUserID": return _UpdateUserID;
                    case "UpdateTime": return _UpdateTime;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ID": _ID = value.ToInt(); break;
                    case "RowID": _RowID = value.ToInt(); break;
                    case "TableID": _TableID = value.ToInt(); break;
                    case "FieldID": _FieldID = value.ToInt(); break;
                    case "IntValue": _IntValue = value.ToInt(); break;
                    case "StrValue": _StrValue = Convert.ToString(value); break;
                    case "DateValue": _DateValue = value.ToDateTime(); break;
                    case "DoubleValue": _DoubleValue = value.ToDouble(); break;
                    case "CreateUser": _CreateUser = Convert.ToString(value); break;
                    case "CreateUserID": _CreateUserID = value.ToInt(); break;
                    case "CreateTime": _CreateTime = value.ToDateTime(); break;
                    case "UpdateUser": _UpdateUser = Convert.ToString(value); break;
                    case "UpdateUserID": _UpdateUserID = value.ToInt(); break;
                    case "UpdateTime": _UpdateTime = value.ToDateTime(); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得表字段值字段信息的快捷方式</summary>
        public partial class _
        {
            /// <summary></summary>
            public static readonly Field ID = FindByName("ID");

            /// <summary>记录ID</summary>
            public static readonly Field RowID = FindByName("RowID");

            /// <summary>表ID</summary>
            public static readonly Field TableID = FindByName("TableID");

            /// <summary>表字段ID</summary>
            public static readonly Field FieldID = FindByName("FieldID");

            /// <summary>Int值</summary>
            public static readonly Field IntValue = FindByName("IntValue");

            /// <summary>string 值</summary>
            public static readonly Field StrValue = FindByName("StrValue");

            /// <summary>日期值</summary>
            public static readonly Field DateValue = FindByName("DateValue");

            /// <summary>Double值</summary>
            public static readonly Field DoubleValue = FindByName("DoubleValue");

            /// <summary>创建者</summary>
            public static readonly Field CreateUser = FindByName("CreateUser");

            /// <summary>创建用户</summary>
            public static readonly Field CreateUserID = FindByName("CreateUserID");

            /// <summary>创建时间</summary>
            public static readonly Field CreateTime = FindByName("CreateTime");

            /// <summary>更新者</summary>
            public static readonly Field UpdateUser = FindByName("UpdateUser");

            /// <summary>更新用户</summary>
            public static readonly Field UpdateUserID = FindByName("UpdateUserID");

            /// <summary>更新时间</summary>
            public static readonly Field UpdateTime = FindByName("UpdateTime");

            static Field FindByName(String name) => Meta.Table.FindByName(name);
        }

        /// <summary>取得表字段值字段名称的快捷方式</summary>
        public partial class __
        {
            /// <summary></summary>
            public const String ID = "ID";

            /// <summary>记录ID</summary>
            public const String RowID = "RowID";

            /// <summary>表ID</summary>
            public const String TableID = "TableID";

            /// <summary>表字段ID</summary>
            public const String FieldID = "FieldID";

            /// <summary>Int值</summary>
            public const String IntValue = "IntValue";

            /// <summary>string 值</summary>
            public const String StrValue = "StrValue";

            /// <summary>日期值</summary>
            public const String DateValue = "DateValue";

            /// <summary>Double值</summary>
            public const String DoubleValue = "DoubleValue";

            /// <summary>创建者</summary>
            public const String CreateUser = "CreateUser";

            /// <summary>创建用户</summary>
            public const String CreateUserID = "CreateUserID";

            /// <summary>创建时间</summary>
            public const String CreateTime = "CreateTime";

            /// <summary>更新者</summary>
            public const String UpdateUser = "UpdateUser";

            /// <summary>更新用户</summary>
            public const String UpdateUserID = "UpdateUserID";

            /// <summary>更新时间</summary>
            public const String UpdateTime = "UpdateTime";
        }
        #endregion
    }

    /// <summary>表字段值接口</summary>
    public partial interface IDataFieldValue
    {
        #region 属性
        /// <summary></summary>
        Int32 ID { get; set; }

        /// <summary>记录ID</summary>
        Int32 RowID { get; set; }

        /// <summary>表ID</summary>
        Int32 TableID { get; set; }

        /// <summary>表字段ID</summary>
        Int32 FieldID { get; set; }

        /// <summary>Int值</summary>
        Int32 IntValue { get; set; }

        /// <summary>string 值</summary>
        String StrValue { get; set; }

        /// <summary>日期值</summary>
        DateTime DateValue { get; set; }

        /// <summary>Double值</summary>
        Double DoubleValue { get; set; }

        /// <summary>创建者</summary>
        String CreateUser { get; set; }

        /// <summary>创建用户</summary>
        Int32 CreateUserID { get; set; }

        /// <summary>创建时间</summary>
        DateTime CreateTime { get; set; }

        /// <summary>更新者</summary>
        String UpdateUser { get; set; }

        /// <summary>更新用户</summary>
        Int32 UpdateUserID { get; set; }

        /// <summary>更新时间</summary>
        DateTime UpdateTime { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}